package org.example.controller;

import org.example.entity.Car;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@RestController
public class HelloController {
    @GetMapping("/hello01")
    public String hello01() {
        return "hello, springboot!";
    }
    @GetMapping("/hello02")
    public Car hello02(){
        Car car = new Car();
        car.setId(1);
        car.setCarName("兰博基尼毒药");
        car.setBrand("兰博基尼");
        car.setOilWear(18.5);
        car.setState(1);
        return car;
    }
    @GetMapping("/hello03")
    public List<Car> hello03() {
        List<Car> carList = new ArrayList<>();
        for (int i = 0; i < 10; i++) {
            carList.add(new Car(i, "奔驰"+i, "奔驰", 15.5,0));
        }
        return carList;
    }
    @GetMapping("/hello04")
    public Map<String, String> hello04() {
        Map<String, String> map = new HashMap<>();
        map.put("身高", "185");
        map.put("体重", "95");
        map.put("年龄", "18");
        map.put("性别", "男");
        return map;
    }
}
